/**
 * 系统资源添加js
 */
var comValidform=null;
var returnStatus=false;
var sysParameterUpdate={
	dataCache:null,
	key:null,	
	startEvent:function(){
		comValidform=$(".com-addForm").Validform({
			tiptype:2,
			tipSweep:true,
			beforeSubmit:function(curform){
				
				var url = 'mgr/parameterCtrl/update';
				var params = jsUtils.serializeJson($('.com-addForm'));
				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode==200){
						//关闭窗口并刷新数据
						returnStatus=true;
					}
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	showInfoById : function() {
		 
		var id = art.dialog.data('updId');
		sysParameterUpdate.key = id+ "_Parameter_Key";
		 

		var ret = eval('(' + localStorage.getItem(sysParameterUpdate.key) + ')');
		 
		 
		for ( var i in ret) {
			var text = ret[i];
			if(i != "descStr"){
				$('#com-updForm input[name="' +i+ '"]').val(text);
			}else{
				$('#com-updForm textarea[name="' +i+ '"]').val(text);
			}
		}
	},
	
	init:function(){
		sysParameterUpdate.startEvent();
		sysParameterUpdate.showInfoById();
	}
}
$(document).ready(function() {
	sysParameterUpdate.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}